package cn.wawi.controller.data;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import cn.wawi.common.easyui.DataGrid;
import cn.wawi.controller.BaseController;
import cn.wawi.entity.data.Enterprise;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/data_enterprise")
public class EnterpriseController extends BaseController<Enterprise>{
	
	@InitBinder({"trade"})
	public void initBinder(WebDataBinder binder) {
		binder.setFieldDefaultPrefix("trade.");
	}
	
	@ResponseBody
	@RequestMapping(value="/list",method=RequestMethod.GET)
	public DataGrid list(HttpServletRequest request){
		return findAllByPage(request);
	}
	/**
	 * 获取所有企业
	 * 
	 * @return easyui-combobox
	 */
	@ResponseBody
	@RequestMapping(value = "/getEnterprise", method = RequestMethod.GET)
	public List<Enterprise> getEnterprise() {
		List<Enterprise> list = enterpriseDao.findAll(null);
		return list;
	}
}
